package com.neusoft.demo3.controller;

import com.neusoft.demo3.bean.Banner;
import com.neusoft.demo3.config.AjaxResult;
import com.neusoft.demo3.mapper.BannerMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("banner")
public class BannerController   {
    @Autowired
    private BannerMapper bannerMapper;
    @GetMapping("list")
    public Object findall(){
        try{
            List<Banner> list= bannerMapper.selectList(null);
            return AjaxResult.success(list);
        }catch(Exception e){
            e.printStackTrace();
            return AjaxResult.exception(e.getMessage());
        }
    }
}
